package com.joeshing.base.model;

// Generated 2012-8-25 15:48:59 by Hibernate Tools 3.4.0.CR1

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

/**
 * 信息价细节
 */
@Entity
@Table(name = "cost_price_infoDetail_2011")
@Indexed
public class InfoPriceDetail_2011 implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6182121073822279809L;

	private String id;
	// 常量
	public static String SPLIT_QUERYWORD = ":::";// 用于区分各个模糊查询字段的内容
	// 【注意】如果这里的字段有改变，则需要到infopricedetaildaoimpl里同步兼容对应的插入batchInsert等方法
	// 【注意】如果字段有改动，需更新此类里的copyTo(InfoPriceDetail otherDetail)方法
	// private InfoPriceMain main;// 对应的信息价格库
	private String mainID;
	private String sysCode;
	private Double unitPrice;
	private Double minUnitPrice;// 最底单价
	private Double maxUnitPrice;// 最高单价
	private Double avgUnitPrice;// 平均单价
	private String name;
	private String standard;// 规格型号
	private String unit;
	private String code03;
	private String code06;
	private String code10;
	private String newCode;
	private String oldCode;
	private String code;
	private String city;
	private String date;
	private String remark;
	private String queryword;// 用于将需要模糊查询的字段合并于此，以提高查询效率
	// 将infopricemain里需要连表的数据加到此，以提高查询速度（单表查询）
	private String mainWebsite;
	private String mainType;
	private Integer mainYear;
	private Integer mainMonth;
	private String mainCity;
	private String mainCounty;
	private String mainState;

	// 更新queryword的值
	public void updateQueryword() {
		queryword = sysCode + SPLIT_QUERYWORD + name + SPLIT_QUERYWORD + standard + SPLIT_QUERYWORD + unit + SPLIT_QUERYWORD + remark;
	}

	//

	public InfoPriceDetail_2011() {
	}

	public InfoPriceDetail_2011(String id) {
		this.id = id;
	}

	public InfoPriceDetail_2011(String id, String mainID, String sysCode, Double unitPrice, Double minUnitPrice, Double maxUnitPrice, Double avgUnitPrice, String name,
			String standard,
			String unit, String code03, String code06, String code10, String newCode, String oldCode, String code, String city, String date, String remark, String queryword,
			String mainWebsite, String mainType, Integer mainYear, Integer mainMonth, String mainCity, String mainState) {
		this.id = id;
		this.mainID = mainID;
		this.sysCode = sysCode;
		this.unitPrice = unitPrice;
		this.minUnitPrice = minUnitPrice;
		this.maxUnitPrice = maxUnitPrice;
		this.avgUnitPrice = avgUnitPrice;
		this.name = name;
		this.standard = standard;// 规格型号
		this.unit = unit;
		this.code03 = code03;
		this.code06 = code06;
		this.code10 = code10;
		this.newCode = newCode;
		this.oldCode = oldCode;
		this.code = code;
		this.city = city;
		this.date = date;
		this.remark = remark;
		this.queryword = queryword;
		this.mainWebsite = mainWebsite;
		this.mainType = mainType;
		this.mainYear = mainYear;
		this.mainMonth = mainMonth;
		this.mainCity = mainCity;
		this.mainState = mainState;
	}

	@Id
	@GeneratedValue(generator = "hibernate-uuid")
	@GenericGenerator(name = "hibernate-uuid", strategy = "uuid.hex")
	@Column(name = "id", unique = true, nullable = false, length = 32)
	@DocumentId
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "mainID", length = 64)
	@Field(store = Store.YES)
	public String getMainID() {
		return mainID;
	}

	public void setMainID(String mainID) {
		this.mainID = mainID;
	}

	@Column(name = "sysCode", length = 64)
	@Field(store = Store.YES)
	public String getSysCode() {
		return sysCode;
	}

	public void setSysCode(String sysCode) {
		this.sysCode = sysCode;
	}

	@Column(name = "unitPrice")
	public Double getUnitPrice() {
		if (unitPrice == null)
			return 0.0;
		return unitPrice;
	}

	public void setUnitPrice(Double unitPrice) {
		this.unitPrice = unitPrice;
	}

	@Column(name = "minUnitPrice")
	public Double getMinUnitPrice() {
		if (minUnitPrice == null)
			return 0.0;
		return minUnitPrice;
	}

	public void setMinUnitPrice(Double minUnitPrice) {
		this.minUnitPrice = minUnitPrice;
	}

	@Column(name = "maxUnitPrice")
	public Double getMaxUnitPrice() {
		if (maxUnitPrice == null)
			return 0.0;
		return maxUnitPrice;
	}

	public void setMaxUnitPrice(Double maxUnitPrice) {
		this.maxUnitPrice = maxUnitPrice;
	}

	@Column(name = "avgUnitPrice")
	public Double getAvgUnitPrice() {
		if (avgUnitPrice == null)
			return 0.0;
		return avgUnitPrice;
	}

	public void setAvgUnitPrice(Double avgUnitPrice) {
		this.avgUnitPrice = avgUnitPrice;
	}

	@Column(name = "name", length = 100)
	@Field(store = Store.YES)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "standard", length = 500)
	@Field(store = Store.YES)
	public String getStandard() {
		return standard;
	}

	public void setStandard(String standard) {
		this.standard = standard;
	}

	@Column(name = "unit", length = 50)
	@Field(store = Store.YES)
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(name = "code03", length = 64)
	@Field(store = Store.YES)
	public String getCode03() {
		return code03;
	}

	public void setCode03(String code03) {
		this.code03 = code03;
	}

	@Column(name = "code06", length = 64)
	@Field(store = Store.YES)
	public String getCode06() {
		return code06;
	}

	public void setCode06(String code06) {
		this.code06 = code06;
	}

	@Column(name = "code10", length = 64)
	@Field(store = Store.YES)
	public String getCode10() {
		return code10;
	}

	public void setCode10(String code10) {
		this.code10 = code10;
	}

	@Column(name = "newCode", length = 64)
	@Field(store = Store.YES)
	public String getNewCode() {
		return newCode;
	}

	public void setNewCode(String newCode) {
		this.newCode = newCode;
	}

	@Column(name = "oldCode", length = 64)
	@Field(store = Store.YES)
	public String getOldCode() {
		return oldCode;
	}

	public void setOldCode(String oldCode) {
		this.oldCode = oldCode;
	}

	@Column(name = "code", length = 64)
	@Field(store = Store.YES)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "city", length = 50)
	@Field(store = Store.YES)
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "date", length = 50)
	@Field(store = Store.YES)
	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	@Column(name = "remark", length = 1000)
	@Field(store = Store.YES)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "queryword", length = 1000)
	@Field(store = Store.YES)
	public String getQueryword() {
		return queryword;
	}

	public void setQueryword(String queryword) {
		this.queryword = queryword;
	}

	@Column(name = "mainWebsite", length = 64)
	@Field(store = Store.YES)
	public String getMainWebsite() {
		return mainWebsite;
	}

	public void setMainWebsite(String mainWebsite) {
		this.mainWebsite = mainWebsite;
	}

	@Column(name = "mainType", length = 20)
	@Field(store = Store.YES)
	public String getMainType() {
		return mainType;
	}

	public void setMainType(String mainType) {
		this.mainType = mainType;
	}

	@Column(name = "mainYear")
	@Field(store = Store.YES)
	public Integer getMainYear() {
		if (mainYear == null)
			return 0;
		return mainYear;
	}

	public void setMainYear(Integer mainYear) {
		this.mainYear = mainYear;
	}

	@Column(name = "mainMonth")
	@Field(store = Store.YES)
	public Integer getMainMonth() {
		if (mainMonth == null)
			return 0;
		return mainMonth;
	}

	public void setMainMonth(Integer mainMonth) {
		this.mainMonth = mainMonth;
	}

	@Column(name = "mainCity", length = 6)
	@Field(store = Store.YES)
	public String getMainCity() {
		return mainCity;
	}

	public void setMainCity(String mainCity) {
		this.mainCity = mainCity;
	}

	@Column(name = "mainState", length = 4)
	@Field(store = Store.YES)
	public String getMainState() {
		return mainState;
	}

	public void setMainState(String mainState) {
		this.mainState = mainState;
	}

	@Column(name = "mainCounty", length = 20)
	@Field(store = Store.YES)
	public String getMainCounty() {
		return mainCounty;
	}

	public void setMainCounty(String mainCounty) {
		this.mainCounty = mainCounty;
	}

}
